import request from '@/utils/request'
import { removeToken } from '@/utils/storage'
import { GET_UER, LOGOUT } from '../constants'
//确认退出
export const logout = () => {
  return async (dispatch) => {
    removeToken()
    dispatch({
      type: LOGOUT,
    })
  }
}
//获取用户信息
export const getUser = () => {
  return async (dispatch) => {
    const res = await request.get('/user')
    dispatch({
      type: GET_UER,
      payLoad: res.data.data,
    })
  }
}
